import request from '@/utils/request'

// 查询人力资源列表
export function listHrBase(query) {
  return request({
    url: '/hrBase/hrBase/list',
    method: 'get',
    params: query
  })
}

// 查询人力资源详细
export function getHrBase(id) {
  return request({
    url: '/hrBase/hrBase/' + id,
    method: 'get'
  })
}

// 保存人力资源
export function saveHrBase(data) {
  return request({
    url: '/hrBase/hrBase/save',
    method: 'post',
    data: data
  })
}

// 删除人力资源
export function delHrBase(id) {
  return request({
    url: '/hrBase/hrBase/' + id,
    method: 'delete'
  })
}

// 导出人力资源
export function exportHrBase(query) {
  return request({
    url: '/hrBase/hrBase/export',
    method: 'get',
    params: query
  })
}

// 校验录入的员工是否重复
export function checkUserId(query) {
  return request({
    url: '/hrBase/hrBase/check/user/',
    method: 'get',
    params: query
  }).then(result => result.code === 200 && result.data)
}

// 员工统计
export function staffCount() {
  return request({
    url: '/hrBase/hrBase/staffCount',
    method: 'get'
  })
}

// 获取员工列表
export function getStaffList(params) {
  return request({
    url: '/hrBase/hrBase/getStaffList',
    method: 'get',
    params: params
  })
}

// 查询人员花名册考勤统计列表
export function listAttendance(query) {
  return request({
    url: '/hrBase/hrBase/attendanceList',
    method: 'get',
    params: query
  })
}

// 查询人员花名册考勤统计列表
export function initAttendance() {
  return request({
    url: '/vacation/oaVacation/initGenerateAttendance',
    method: 'get'
  })
}
